<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

		<title>搜索页面</title>

		<link href="../AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css" />
		<link href="../AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css" />

		<link href="../basic/css/demo.css" rel="stylesheet" type="text/css" />

		<link href="../css/seastyle.css" rel="stylesheet" type="text/css" />
		<link href="../js/Pagination/css/pagination.css" rel="stylesheet" type="text/css"/>
		<script type="text/javascript" src="../basic/js/jquery-1.7.min.js"></script>
		<script type="text/javascript" src="../js/script.js"></script>
		<script type="text/javascript" src="../js/common.js"></script>
		<script type="text/javascript" src="../js/Pagination/js/pagination.min.js"></script>
	</head>

	<body>

		<!--顶部导航条 -->
		<div class="am-container header">
			<ul class="message-l">
				<div class="topMessage">
					<div class="menu-hd" id="indexHeader">
					</div>
				</div>
			</ul>
			<ul class="message-r">
				<div class="topMessage home">
					<div class="menu-hd">
						<a href="index.html" target="_top" class="h">商城首页</a>
					</div>
				</div>
				<div class="topMessage my-shangcheng">
					<div class="menu-hd MyShangcheng">
						<a href="pindex.html" target="_top"><i class="am-icon-user am-icon-fw"></i>个人中心</a>
					</div>
				</div>
				<div class="topMessage mini-cart">
					<div class="menu-hd">
						<a id="mc-menu-hd" href="shopcart.html" target="_top"><i class="am-icon-shopping-cart  am-icon-fw"></i><span>购物车</span><strong id="J_MiniCartNum" class="h"></strong></a>
					</div>
				</div>
			</ul>
		</div>

		<!--悬浮搜索框-->

		<div class="nav white">
			<div class="logo"><img src="../images/logo.png" /></div>
			<div class="logoBig">
			</div>

			<div class="search-bar pr">
				<a name="index_none_header_sysc" href="#"></a>
				
			</div>
		</div>

		<div class="clear"></div>
		<b class="line"></b>
		<div class="search">
			<div class="search-list">
				<div class="nav-table">
					<div class="nav-cont">
						<ul>
							<li class="index">
								<a href="index.html">首页</a>
							</li>
							<li class="qc">
								<a href="pindex.html">个人中心</a>
							</li>
						</ul>
						<div class="nav-extra" onclick="gotoShopcart()">
							<i class="am-icon-user-secret am-icon-md nav-user"></i><b></b>我的购物车
							<i class="am-icon-angle-right" style="padding-left: 10px;"></i>
						</div>
					</div>
				</div>

				<div class="am-g am-g-fixed">
					<div class="am-u-sm-12 am-u-md-12">
						<div class="search-content">
							<ul id="gdItem" class="am-avg-sm-2 am-avg-md-3 am-avg-lg-4 boxes">
							</ul>
						</div>
						<div class="clear"></div>
					</div>
					<!--分页-->
					<div id="pagination" style="margin: 20px;float: right;"></div>
				</div>
				
				
				<div class="footer">
					<div class="footer-hd">
						<p>
							<a href="#">商城首页</a>
							<b>|</b>
							<a href="#">支付宝</a>
							<b>|</b>
							<a href="#">物流</a>
						</p>
					</div>
					<div class="footer-bd">
						<p>
							<a href="#">合作伙伴</a>
							<a href="#">联系我们</a>
							<a href="#">网站地图</a>
							<em>© com 版权所有</em>
						</p>
					</div>
				</div>
			</div>
		</div>

		<script>
			window.jQuery || document.write('<script src="basic/js/jquery-1.9.min.js"><\/script>');
		</script>
		<script type="text/javascript" src="../basic/js/quick_links.js"></script>

		<div class="theme-popover-mask"></div>
		<script>
			function gotoShopcart(){
		    	window.location.href="shopcart.html";
		    }
			function getQueryStringByName(name) {
		        var result = location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i"));
		        if (result == null || result.length < 1) {
		            return "";
		        }
		        return result[1];
		    }
			
			function loadData(currPage, pageSize) {
				var typeid=getQueryStringByName("typeid");
	            $.ajax({
	                url:"/goods/selectByType",
	                type:"post",
	                data:{"page":currPage,"rows":pageSize,"typeid":typeid},
	                //其它参数选项请自填
	                success: function(res) {
	                //处理数据
	                //设置分页插件显示
	                $("#pagination").whjPaging("setPage", {currPage: res.currPage, totalPage: res.totalPage, totalSize: res.totalSize});
	                
	                //清空子节点
	                $("#gdItem").children().remove();
	                //显示商品信息
	                for(var i=0;i<res.data.length;i++){
	                	$("#gdItem").append(`
	                			<li>
	                				<a href="/portal/home/introduction.html?goodsid=${res.data[i].id}">
	                                <div class="i-pic limit">
	                                    <img src="${res.data[i].img1}" />
	                                    <p class="title fl">${res.data[i].goodsname}</p>
	                                    <p class="price fl">
	                                        <b>¥</b>
	                                        <strong>${res.data[i].price}</strong>
	                                    </p>
	                                </div>
	                                </a>
                                </li>`
                                );
	                }
	                
	              }
	            });
	          }
	        
            $(function(){
                $("#pagination").whjPaging({
                          css: 'css-3',
                          pageSizeOpt: [
                              {'value': 8, 'text': '8条/页', 'selected': true},
                              {'value': 16, 'text': '16条/页'},
                              {'value': 20, 'text': '20条/页'}
                          ],
                          isResetPage: true,
                          callBack: function(currPage, pageSize) {
                              loadData(currPage, pageSize);
                          }
                       }
                );
                loadData(1, 8);
                
                /*检验用户是否登录*/
				if (getCookie("username") == null || getCookie("userid") == null) {
                    $("#indexHeader").append(`
                    		<a href="/portal/home/login.html" target="_top" class="h">亲，请登录</a>
                            <a href="/portal/home/register.html" target="_top">免费注册</a>`);
			    }else{
			    	$("#indexHeader").append(`
                            <a href="#" target="_top" class="h">您好，${getCookie("username")}</a>
                            <a href="javascript:void(0);" onclick="clearCookie()">退出</a>`
                    );
			    }
            });
		</script>
	</body>

</html>